
using System;
using System.Reflection;
using System.Collections;
using UniversalStorageServices;
using UniversalStorageServices.PersistenceManager;

		

namespace Example
{
		
	public interface IAnimal
	{
		string Id { get; set; }
		System.String Description { get; set; }
		System.Int32 LegsNumber { get; set; }
		
	}
	
	
		/// <summary>
	/// <para>
	/// A collection that stores <see cref='Animal'/> objects.
	/// </para>
	/// </summary>
	/// <seealso cref='AnimalCollection'/>
	[Serializable()]
	public class  AnimalCollection : IPersistableCollection 
	{	
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='AnimalCollection'/>.
		/// </para>
		/// </summary>
		public AnimalCollection()
		{
		}
		
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='AnimalCollection'/> based on another <see cref='AnimalCollection'/>.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A <see cref='AnimalCollection'/> from which the contents are copied
		/// </param>
		public AnimalCollection( AnimalCollection val)
		{
			this.AddRange(val);	
		}
		
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='AnimalCollection'/> containing any array of <see cref='Animal'/> objects.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A array of <see cref='Animal'/> objects with which to intialize the collection
		/// </param>
		public AnimalCollection( Animal[] val)
		{
			this.AddRange(val);
		}
		
		public AnimalCollection (Entity parentEntity, string role, IPersistableCollection data): base(parentEntity, role, data)
		{
		}
		
		/// <summary>
		/// <para>Represents the entry at the specified index of the <see cref='Animal'/>.</para>
		/// </summary>
		/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
		/// <value>
		/// <para> The entry at the specified index of the collection.</para>
		/// </value>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
		public new Animal this[int index] 
		{
			get 
			{
				return ((Animal)base[index]);
			}
			set 
			{
				base[index] = value;
			}
		}
		
		/// <summary>
		/// <para>Adds a <see cref='Animal'/> with the specified value to the 
		/// <see cref='AnimalCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Animal'/> to add.</param>
		/// <returns>
		/// <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='AnimalCollection.AddRange'/>
		public int Add( Animal val)
		{
			return base.Add(val);
		}
		
	
		
		/// <summary>
		/// <para>
		/// Adds the contents of another <see cref='AnimalCollection'/> to the end of the collection.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A <see cref='AnimalCollection'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		/// <para>None.</para>
		/// </returns>
		/// <seealso cref='AnimalCollection.Add'/>
		public void AddRange( AnimalCollection val)
		{
			base.AddRange(val);
		}
		public void AddRange( Animal[] val)
		{
			base.AddRange(val);
		}
		
		/// <summary>
		/// <para>Gets a value indicating whether the 
		/// <see cref='AnimalCollection'/> contains the specified <see cref='Animal'/>.</para>
		/// </summary>
		/// <param name='val'>The <see cref='Animal'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='Animal'/> is contained in the collection; 
		/// otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='AnimalCollection.IndexOf'/>
		public bool Contains( Animal val)
		{
			return List.Contains(val);
		}
		
		/// <summary>
		/// <para>Copies the <see cref='AnimalCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the 
		/// specified index.</para>
		/// </summary>
		/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='AnimalCollection'/> .</para></param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <returns>
		/// <para>None.</para>
		/// </returns>
		/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='AnimalCollection'/> is greater than the available space between <paramref name='index'/> and the end of <paramref name='array'/>.</para></exception>
		/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='System.Array'/>
		public void CopyTo( Animal[] array, int index)
		{
			List.CopyTo(array, index);
		}
		
		/// <summary>
		/// <para>Returns the index of a <see cref='Animal'/> in 
		/// the <see cref='AnimalCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Animal'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='Animal'/> of <paramref name='val'/> in the 
		/// <see cref='AnimalCollection'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='AnimalCollection.Contains'/>
		public int IndexOf( Animal val)
		{
			return List.IndexOf(val);
		}
		
		/// <summary>
		/// <para>Inserts a <see cref='Animal'/> into the <see cref='AnimalCollection'/> at the specified index.</para>
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
		/// <param name='val'>The <see cref='Animal'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='AnimalCollection.Add'/>
		public void Insert(int index,  Animal val)
		{
			List.Insert(index, val);
		}
		
		/// <summary>
		/// <para>Returns an enumerator that can iterate through 
		/// the <see cref='AnimalCollection'/> .</para>
		/// </summary>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='System.Collections.IEnumerator'/>
		public new  AnimalEnumerator GetEnumerator()
		{
			return new  AnimalEnumerator(this);
		}
		
		/// <summary>
		/// <para> Removes a specific <see cref='Animal'/> from the 
		/// <see cref='AnimalCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Animal'/> to remove from the <see cref='AnimalCollection'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='val'/> is not found in the Collection. </exception>
		public void Remove( Animal val)
		{
			List.Remove(val);
		}
		
		public class  AnimalEnumerator : IEnumerator
		{
			IEnumerator baseEnumerator;
			IEnumerable temp;
			
			public  AnimalEnumerator( AnimalCollection mappings)
			{
				this.temp = mappings;
				this.baseEnumerator = temp.GetEnumerator();
			}
			
			public  Animal Current 
			{
				get 
				{
					return (( Animal)(baseEnumerator.Current));
				}
			}
			
			object IEnumerator.Current 
			{
				get 
				{
					return baseEnumerator.Current;
				}
			}
			
			public bool MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			bool IEnumerator.MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			public void Reset()
			{
				baseEnumerator.Reset();
			}
			
			void IEnumerator.Reset()
			{
				baseEnumerator.Reset();
			}
		}
	}

	
	[Serializable]
	public class Animal :  IPersistable, IAnimal 
	{		
	
		protected Entity _Entity;
		
		[NonSerialized]
		protected PersistenceManager _PersistenceManager;
		
		Entity IPersistable.Entity
		{
			get
			{
				return _Entity;
			}
			set
			{
				_Entity = value;
			}
		}
		
		PersistenceManager IPersistable.PersistenceManager
		{
			get
			{
				return _PersistenceManager;
			}
			set
			{
				_PersistenceManager = value;
			}
		}
		
		public string Id
		{
			get
			{
				return _Entity.Id;
			}
			set
			{
				_Entity.Id = value;
			}
		}
		
		~Animal()
		{
			if(_PersistenceManager != null)
				_PersistenceManager.RemoveFromCache(this);
		}
	
		void IPersistable.TrackChildren()
		{
			// if the object is not tracked there is nothing to do
			if(_PersistenceManager == null)
				return;
	
		}
		
		void IPersistable.DeleteChildren()
		{	
	
		}
	
		public System.String Description
		{
			get 
			{ 
				if(_Entity.GetValue("Description") == null)
					return (new System.String[1])[0];
				else
					return (System.String)this._Entity["Description"]; 
			}
		
			set 
			{ 
				this._Entity["Description"] = value; 
			}
		}
		
		public System.Int32 LegsNumber
		{
			get 
			{ 
				if(_Entity.GetValue("LegsNumber") == null)
					return (new System.Int32[1])[0];
				else
					return (System.Int32)this._Entity["LegsNumber"]; 
			}
		
			set 
			{ 
				this._Entity["LegsNumber"] = value; 
			}
		}
		
		public Animal ()
		{
			
			this._Entity = new Entity(PersistenceManager.ConvertNamespaceDomainToEuss(this.GetType().FullName));
		}

		public Animal (Entity e): this()
		{
			this._Entity = e;
		}

		private ParentRelationships _Parents;

		public ParentRelationships Parents
		{
			get
			{
				if (_Parents == null)
					if (_PersistenceManager == null)
						throw new ApplicationException("Can't call Parents untracked objects");
				else
					_Parents = new ParentRelationships(this);

				return _Parents;
			}
		}

		public class ParentRelationships
		{
			private IPersistable _Owner;
	
			public ParentRelationships(IPersistable o)
			{
				_Owner = o;
			}
		
		}
	}
	
	public interface ICat
	{
		string Id { get; set; }
		
	}
	
	
		/// <summary>
	/// <para>
	/// A collection that stores <see cref='Cat'/> objects.
	/// </para>
	/// </summary>
	/// <seealso cref='CatCollection'/>
	[Serializable()]
	public class  CatCollection : IPersistableCollection 
	{	
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='CatCollection'/>.
		/// </para>
		/// </summary>
		public CatCollection()
		{
		}
		
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='CatCollection'/> based on another <see cref='CatCollection'/>.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A <see cref='CatCollection'/> from which the contents are copied
		/// </param>
		public CatCollection( CatCollection val)
		{
			this.AddRange(val);	
		}
		
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='CatCollection'/> containing any array of <see cref='Cat'/> objects.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A array of <see cref='Cat'/> objects with which to intialize the collection
		/// </param>
		public CatCollection( Cat[] val)
		{
			this.AddRange(val);
		}
		
		public CatCollection (Entity parentEntity, string role, IPersistableCollection data): base(parentEntity, role, data)
		{
		}
		
		/// <summary>
		/// <para>Represents the entry at the specified index of the <see cref='Cat'/>.</para>
		/// </summary>
		/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
		/// <value>
		/// <para> The entry at the specified index of the collection.</para>
		/// </value>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
		public new Cat this[int index] 
		{
			get 
			{
				return ((Cat)base[index]);
			}
			set 
			{
				base[index] = value;
			}
		}
		
		/// <summary>
		/// <para>Adds a <see cref='Cat'/> with the specified value to the 
		/// <see cref='CatCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Cat'/> to add.</param>
		/// <returns>
		/// <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='CatCollection.AddRange'/>
		public int Add( Cat val)
		{
			return base.Add(val);
		}
		
	
		
		/// <summary>
		/// <para>
		/// Adds the contents of another <see cref='CatCollection'/> to the end of the collection.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A <see cref='CatCollection'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		/// <para>None.</para>
		/// </returns>
		/// <seealso cref='CatCollection.Add'/>
		public void AddRange( CatCollection val)
		{
			base.AddRange(val);
		}
		public void AddRange( Cat[] val)
		{
			base.AddRange(val);
		}
		
		/// <summary>
		/// <para>Gets a value indicating whether the 
		/// <see cref='CatCollection'/> contains the specified <see cref='Cat'/>.</para>
		/// </summary>
		/// <param name='val'>The <see cref='Cat'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='Cat'/> is contained in the collection; 
		/// otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='CatCollection.IndexOf'/>
		public bool Contains( Cat val)
		{
			return List.Contains(val);
		}
		
		/// <summary>
		/// <para>Copies the <see cref='CatCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the 
		/// specified index.</para>
		/// </summary>
		/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='CatCollection'/> .</para></param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <returns>
		/// <para>None.</para>
		/// </returns>
		/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='CatCollection'/> is greater than the available space between <paramref name='index'/> and the end of <paramref name='array'/>.</para></exception>
		/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='System.Array'/>
		public void CopyTo( Cat[] array, int index)
		{
			List.CopyTo(array, index);
		}
		
		/// <summary>
		/// <para>Returns the index of a <see cref='Cat'/> in 
		/// the <see cref='CatCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Cat'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='Cat'/> of <paramref name='val'/> in the 
		/// <see cref='CatCollection'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='CatCollection.Contains'/>
		public int IndexOf( Cat val)
		{
			return List.IndexOf(val);
		}
		
		/// <summary>
		/// <para>Inserts a <see cref='Cat'/> into the <see cref='CatCollection'/> at the specified index.</para>
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
		/// <param name='val'>The <see cref='Cat'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='CatCollection.Add'/>
		public void Insert(int index,  Cat val)
		{
			List.Insert(index, val);
		}
		
		/// <summary>
		/// <para>Returns an enumerator that can iterate through 
		/// the <see cref='CatCollection'/> .</para>
		/// </summary>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='System.Collections.IEnumerator'/>
		public new  CatEnumerator GetEnumerator()
		{
			return new  CatEnumerator(this);
		}
		
		/// <summary>
		/// <para> Removes a specific <see cref='Cat'/> from the 
		/// <see cref='CatCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Cat'/> to remove from the <see cref='CatCollection'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='val'/> is not found in the Collection. </exception>
		public void Remove( Cat val)
		{
			List.Remove(val);
		}
		
		public class  CatEnumerator : IEnumerator
		{
			IEnumerator baseEnumerator;
			IEnumerable temp;
			
			public  CatEnumerator( CatCollection mappings)
			{
				this.temp = mappings;
				this.baseEnumerator = temp.GetEnumerator();
			}
			
			public  Cat Current 
			{
				get 
				{
					return (( Cat)(baseEnumerator.Current));
				}
			}
			
			object IEnumerator.Current 
			{
				get 
				{
					return baseEnumerator.Current;
				}
			}
			
			public bool MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			bool IEnumerator.MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			public void Reset()
			{
				baseEnumerator.Reset();
			}
			
			void IEnumerator.Reset()
			{
				baseEnumerator.Reset();
			}
		}
	}

	
	[Serializable]
	public class Cat : Animal, IPersistable, ICat 
	{		
	
		void IPersistable.TrackChildren()
		{
			// if the object is not tracked there is nothing to do
			if(_PersistenceManager == null)
				return;
	
		}
		
		void IPersistable.DeleteChildren()
		{	
	
		}
	
		public Cat ()
		{
			
			this._Entity = new Entity(PersistenceManager.ConvertNamespaceDomainToEuss(this.GetType().FullName));
		}

		public Cat (Entity e): this()
		{
			this._Entity = e;
		}

		private ParentRelationships _Parents;

		public new ParentRelationships Parents
		{
			get
			{
				if (_Parents == null)
					if (_PersistenceManager == null)
						throw new ApplicationException("Can't call Parents untracked objects");
				else
					_Parents = new ParentRelationships(this);

				return _Parents;
			}
		}

		public new class ParentRelationships
		{
			private IPersistable _Owner;
	
			public ParentRelationships(IPersistable o)
			{
				_Owner = o;
			}
		
		}
	}
	
	public interface IDog
	{
		string Id { get; set; }
		
	}
	
	
		/// <summary>
	/// <para>
	/// A collection that stores <see cref='Dog'/> objects.
	/// </para>
	/// </summary>
	/// <seealso cref='DogCollection'/>
	[Serializable()]
	public class  DogCollection : IPersistableCollection 
	{	
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='DogCollection'/>.
		/// </para>
		/// </summary>
		public DogCollection()
		{
		}
		
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='DogCollection'/> based on another <see cref='DogCollection'/>.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A <see cref='DogCollection'/> from which the contents are copied
		/// </param>
		public DogCollection( DogCollection val)
		{
			this.AddRange(val);	
		}
		
		/// <summary>
		/// <para>
		/// Initializes a new instance of <see cref='DogCollection'/> containing any array of <see cref='Dog'/> objects.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A array of <see cref='Dog'/> objects with which to intialize the collection
		/// </param>
		public DogCollection( Dog[] val)
		{
			this.AddRange(val);
		}
		
		public DogCollection (Entity parentEntity, string role, IPersistableCollection data): base(parentEntity, role, data)
		{
		}
		
		/// <summary>
		/// <para>Represents the entry at the specified index of the <see cref='Dog'/>.</para>
		/// </summary>
		/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
		/// <value>
		/// <para> The entry at the specified index of the collection.</para>
		/// </value>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
		public new Dog this[int index] 
		{
			get 
			{
				return ((Dog)base[index]);
			}
			set 
			{
				base[index] = value;
			}
		}
		
		/// <summary>
		/// <para>Adds a <see cref='Dog'/> with the specified value to the 
		/// <see cref='DogCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Dog'/> to add.</param>
		/// <returns>
		/// <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='DogCollection.AddRange'/>
		public int Add( Dog val)
		{
			return base.Add(val);
		}
		
	
		
		/// <summary>
		/// <para>
		/// Adds the contents of another <see cref='DogCollection'/> to the end of the collection.
		/// </para>
		/// </summary>
		/// <param name='val'>
		/// A <see cref='DogCollection'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		/// <para>None.</para>
		/// </returns>
		/// <seealso cref='DogCollection.Add'/>
		public void AddRange( DogCollection val)
		{
			base.AddRange(val);
		}
		public void AddRange( Dog[] val)
		{
			base.AddRange(val);
		}
		
		/// <summary>
		/// <para>Gets a value indicating whether the 
		/// <see cref='DogCollection'/> contains the specified <see cref='Dog'/>.</para>
		/// </summary>
		/// <param name='val'>The <see cref='Dog'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='Dog'/> is contained in the collection; 
		/// otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='DogCollection.IndexOf'/>
		public bool Contains( Dog val)
		{
			return List.Contains(val);
		}
		
		/// <summary>
		/// <para>Copies the <see cref='DogCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the 
		/// specified index.</para>
		/// </summary>
		/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='DogCollection'/> .</para></param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <returns>
		/// <para>None.</para>
		/// </returns>
		/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='DogCollection'/> is greater than the available space between <paramref name='index'/> and the end of <paramref name='array'/>.</para></exception>
		/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='System.Array'/>
		public void CopyTo( Dog[] array, int index)
		{
			List.CopyTo(array, index);
		}
		
		/// <summary>
		/// <para>Returns the index of a <see cref='Dog'/> in 
		/// the <see cref='DogCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Dog'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='Dog'/> of <paramref name='val'/> in the 
		/// <see cref='DogCollection'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='DogCollection.Contains'/>
		public int IndexOf( Dog val)
		{
			return List.IndexOf(val);
		}
		
		/// <summary>
		/// <para>Inserts a <see cref='Dog'/> into the <see cref='DogCollection'/> at the specified index.</para>
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
		/// <param name='val'>The <see cref='Dog'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='DogCollection.Add'/>
		public void Insert(int index,  Dog val)
		{
			List.Insert(index, val);
		}
		
		/// <summary>
		/// <para>Returns an enumerator that can iterate through 
		/// the <see cref='DogCollection'/> .</para>
		/// </summary>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='System.Collections.IEnumerator'/>
		public new  DogEnumerator GetEnumerator()
		{
			return new  DogEnumerator(this);
		}
		
		/// <summary>
		/// <para> Removes a specific <see cref='Dog'/> from the 
		/// <see cref='DogCollection'/> .</para>
		/// </summary>
		/// <param name='val'>The <see cref='Dog'/> to remove from the <see cref='DogCollection'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='val'/> is not found in the Collection. </exception>
		public void Remove( Dog val)
		{
			List.Remove(val);
		}
		
		public class  DogEnumerator : IEnumerator
		{
			IEnumerator baseEnumerator;
			IEnumerable temp;
			
			public  DogEnumerator( DogCollection mappings)
			{
				this.temp = mappings;
				this.baseEnumerator = temp.GetEnumerator();
			}
			
			public  Dog Current 
			{
				get 
				{
					return (( Dog)(baseEnumerator.Current));
				}
			}
			
			object IEnumerator.Current 
			{
				get 
				{
					return baseEnumerator.Current;
				}
			}
			
			public bool MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			bool IEnumerator.MoveNext()
			{
				return baseEnumerator.MoveNext();
			}
			
			public void Reset()
			{
				baseEnumerator.Reset();
			}
			
			void IEnumerator.Reset()
			{
				baseEnumerator.Reset();
			}
		}
	}

	
	[Serializable]
	public class Dog : Animal, IPersistable, IDog 
	{		
	
		void IPersistable.TrackChildren()
		{
			// if the object is not tracked there is nothing to do
			if(_PersistenceManager == null)
				return;
	
		}
		
		void IPersistable.DeleteChildren()
		{	
	
		}
	
		public Dog ()
		{
			
			this._Entity = new Entity(PersistenceManager.ConvertNamespaceDomainToEuss(this.GetType().FullName));
		}

		public Dog (Entity e): this()
		{
			this._Entity = e;
		}

		private ParentRelationships _Parents;

		public new ParentRelationships Parents
		{
			get
			{
				if (_Parents == null)
					if (_PersistenceManager == null)
						throw new ApplicationException("Can't call Parents untracked objects");
				else
					_Parents = new ParentRelationships(this);

				return _Parents;
			}
		}

		public new class ParentRelationships
		{
			private IPersistable _Owner;
	
			public ParentRelationships(IPersistable o)
			{
				_Owner = o;
			}
		
		}
	}

}
